]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
messageTray: Remove _fixMarkup() function
authorFlorian Müllner <fmuellner@gnome.org>
Thu, 11 Jun 2015 12:39:36 +0000 (14:39 +0200)
committerFlorian Müllner <fmuellner@gnome.org>
Thu, 11 Jun 2015 12:41:34 +0000 (14:41 +0200)
Commit 053e54f944 copied it to calendar, and since commit 15e42c4d5,
the original is no longer used.

js/ui/messageTray.js
tests/unit/markup.js

index e0d63448f55a79b2eff73b8622280b79ff8a4519..4f1ab7feaaa09d5174e8c7df7b53cea2adf0ef94 100644 (file)
@@ -69,26 +69,6 @@ const Urgency = {
     CRITICAL: 3
 };
 
-function _fixMarkup(text, allowMarkup) {
-    if (allowMarkup) {
-        // Support &amp;, &quot;, &apos;, &lt; and &gt;, escape all other
-        // occurrences of '&'.
-        let _text = text.replace(/&(?!amp;|quot;|apos;|lt;|gt;)/g, '&amp;');
-
-        // Support <b>, <i>, and <u>, escape anything else
-        // so it displays as raw markup.
-        _text = _text.replace(/<(?!\/?[biu]>)/g, '&lt;');
-
-        try {
-            Pango.parse_markup(_text, -1, '');
-            return _text;
-        } catch (e) {}
-    }
-
-    // !allowMarkup, or invalid markup
-    return GLib.markup_escape_text(text, -1);
-}
-
 const FocusGrabber = new Lang.Class({
     Name: 'FocusGrabber',
 
index 586258225e44508a7e6c0fe0a55c5cac4f4cfc70..cf28972edeca9516dc94fb0b9110ff9371ebc19e 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
 
-// Test cases for MessageTray markup parsing
+// Test cases for Calendar markup parsing
 
 const JsUnit = imports.jsUnit;
 const Pango = imports.gi.Pango;
@@ -8,7 +8,7 @@ const Pango = imports.gi.Pango;
 const Environment = imports.ui.environment;
 Environment.init();
 
-const MessageTray = imports.ui.messageTray;
+const Calendar = imports.ui.calendar;
 
 // Assert that @input, assumed to be markup, gets "fixed" to @output,
 // which is valid markup. If @output is null, @input is expected to
@@ -16,7 +16,7 @@ const MessageTray = imports.ui.messageTray;
 function assertConverts(input, output) {
     if (!output)
         output = input;
-    let fixed = MessageTray._fixMarkup(input, true);
+    let fixed = Calendar._fixMarkup(input, true);
     JsUnit.assertEquals(output, fixed);
 
     let parsed = false;
@@ -30,7 +30,7 @@ function assertConverts(input, output) {
 // Assert that @input, assumed to be plain text, gets escaped to @output,
 // which is valid markup.
 function assertEscapes(input, output) {
-    let fixed = MessageTray._fixMarkup(input, false);
+    let fixed = Calendar._fixMarkup(input, false);
     JsUnit.assertEquals(output, fixed);
 
     let parsed = false;